package com.sishu.controller;

import com.sishu.pojo.Cardlibrary;
import com.sishu.service.CardlibraryService;
import com.sishu.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@SuppressWarnings("rawtypes")
@RestController
@Slf4j
@RequestMapping("/card/")
@CrossOrigin(origins = "*")
public class CardlibraryController {

    @Resource
    private CardlibraryService cardlibraryService;


/**
 * @author linyi
 * @date  2025-01-09 14:13:59
 * @description 卡库 controller
 */



    @GetMapping("getrandomcard")  //随机获取一道题库中的卡片
    public Result getrandomcard(@Param("cardType") String cardType){
        return  cardlibraryService.getrandomcard(cardType);
    }


    @PostMapping("insertall")
    public Result insertall(@RequestBody List<Cardlibrary> cardlibraryList) {
        log.info("cardlibraryList:{}",cardlibraryList);

        return cardlibraryService.insertall(cardlibraryList);
    }

}
